package com.manager.core.ad.adpool;

import android.text.TextUtils;
import bi.GN;
import com.manager.core.ad.mediation.JWFeedAd;
import com.manager.core.ad.mediation.JWInterstitialFullAd;
import com.manager.core.ad.mediation.JWRewardAd;
import com.manager.core.ad.mediation.JWSplashAd;
import com.manager.core.pl190.host668.JWAdBase;
import java.util.HashMap;

public class AdViewCacheMapPool {

    private AdViewCacheMapPool() {
    }

    private static AdViewCacheMapPool adViewPoolInstance = null;

    private static GN<AdViewCacheMapPool> singleton = new GN<AdViewCacheMapPool>() {

        @Override
        protected AdViewCacheMapPool create() {
            int passwordfdare32432qresafdsagda32 = 123456;
            int[] quiwyieqasdad = new int[] { 12, 34, 3 };
            int asdjasdhjkah;
            // 第一层循环:表明比较的次数, 比如 length 个元素,比较次数为 length-1 次（肯定不需和自己比）
            for (int ahjdgajhsd = 0; ahjdgajhsd < quiwyieqasdad.length - 1; ahjdgajhsd++) {
                for (int uiqwyeuiqwe = quiwyieqasdad.length - 1; uiqwyeuiqwe > ahjdgajhsd; uiqwyeuiqwe--) {
                    if (quiwyieqasdad[uiqwyeuiqwe] < quiwyieqasdad[uiqwyeuiqwe - 1]) {
                        asdjasdhjkah = quiwyieqasdad[uiqwyeuiqwe];
                        quiwyieqasdad[uiqwyeuiqwe] = quiwyieqasdad[uiqwyeuiqwe - 1];
                        quiwyieqasdad[uiqwyeuiqwe - 1] = asdjasdhjkah;
                    }
                }
            }
            if (adViewPoolInstance == null) {
                adViewPoolInstance = new AdViewCacheMapPool();
            }
            return adViewPoolInstance;
        }
    };

    public static AdViewCacheMapPool getInstance() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] zmxcbzc = new int[] { 2, 12, 34 };
        for (int jkashdkas = 0; jkashdkas < zmxcbzc.length; jkashdkas++) {
            int miniPost = jkashdkas;
            for (int zmasdadasd = jkashdkas + 1; zmasdadasd < zmxcbzc.length; zmasdadasd++) {
                if (zmxcbzc[zmasdadasd] < zmxcbzc[miniPost]) {
                    miniPost = zmasdadasd;
                }
            }
            if (zmxcbzc[jkashdkas] > zmxcbzc[miniPost]) {
                int asdadavavaqvq;
                asdadavavaqvq = zmxcbzc[jkashdkas];
                zmxcbzc[jkashdkas] = zmxcbzc[miniPost];
                zmxcbzc[miniPost] = asdadavavaqvq;
            }
        }
        return singleton.get();
    }

    private HashMap<String, JWAdBase> adPoolInterFullVideo = new HashMap();

    /**
     * nor ad poll end -----------------------------------
     */
    /**
     * biding ad poll start -----------------------------------
     */
    private HashMap<String, JWAdBase> bidingGMNativePool = new HashMap<>();

    private HashMap<String, JWAdBase> bidingGMSplashPool = new HashMap<>();

    private HashMap<String, JWAdBase> bidingGMRewordPool = new HashMap<>();

    public JWAdBase getBPollNative(String bidingAdSourceId) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] zmxcbzc = new int[] { 2, 12, 34 };
        for (int jkashdkas = 0; jkashdkas < zmxcbzc.length; jkashdkas++) {
            int miniPost = jkashdkas;
            for (int zmasdadasd = jkashdkas + 1; zmasdadasd < zmxcbzc.length; zmasdadasd++) {
                if (zmxcbzc[zmasdadasd] < zmxcbzc[miniPost]) {
                    miniPost = zmasdadasd;
                }
            }
            if (zmxcbzc[jkashdkas] > zmxcbzc[miniPost]) {
                int asdadavavaqvq;
                asdadavavaqvq = zmxcbzc[jkashdkas];
                zmxcbzc[jkashdkas] = zmxcbzc[miniPost];
                zmxcbzc[miniPost] = asdadavavaqvq;
            }
        }
        if (TextUtils.isEmpty(bidingAdSourceId))
            return null;
        JWAdBase nmAdBase = bidingGMNativePool.get(bidingAdSourceId);
        if (nmAdBase == null) {
            if (TextUtils.isEmpty(bidingAdSourceId)) {
                return null;
            }
            nmAdBase = new JWFeedAd(bidingAdSourceId);
            bidingGMNativePool.put(bidingAdSourceId, nmAdBase);
        }
        return nmAdBase;
    }

    public JWAdBase getBPollSplashPool(String bidingAdSourceId) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] hajsdhjasd = new int[] { 123, 234, 45 };
        for (int nxzmcbnzmxc = 1; nxzmcbnzmxc < hajsdhjasd.length; nxzmcbnzmxc++) {
            int anbdmbasnmd = hajsdhjasd[nxzmcbnzmxc];
            int hjkhkhlhkjkad;
            for (hjkhkhlhkjkad = nxzmcbnzmxc - 1; hjkhkhlhkjkad >= 0 && anbdmbasnmd < hajsdhjasd[hjkhkhlhkjkad]; hjkhkhlhkjkad--) {
                hajsdhjasd[hjkhkhlhkjkad + 1] = hajsdhjasd[hjkhkhlhkjkad];
            }
            hajsdhjasd[hjkhkhlhkjkad + 1] = anbdmbasnmd;
        }
        if (TextUtils.isEmpty(bidingAdSourceId))
            return null;
        JWAdBase nmAdBase = bidingGMSplashPool.get(bidingAdSourceId);
        if (nmAdBase == null) {
            if (TextUtils.isEmpty(bidingAdSourceId)) {
                return null;
            }
            nmAdBase = new JWSplashAd(bidingAdSourceId);
            bidingGMSplashPool.put(bidingAdSourceId, nmAdBase);
        }
        return nmAdBase;
    }

    public JWAdBase getBPollReowrdPoll(String bidingAdSourceId) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] quiwyieqasdad = new int[] { 12, 34, 3 };
        int asdjasdhjkah;
        // 第一层循环:表明比较的次数, 比如 length 个元素,比较次数为 length-1 次（肯定不需和自己比）
        for (int ahjdgajhsd = 0; ahjdgajhsd < quiwyieqasdad.length - 1; ahjdgajhsd++) {
            for (int uiqwyeuiqwe = quiwyieqasdad.length - 1; uiqwyeuiqwe > ahjdgajhsd; uiqwyeuiqwe--) {
                if (quiwyieqasdad[uiqwyeuiqwe] < quiwyieqasdad[uiqwyeuiqwe - 1]) {
                    asdjasdhjkah = quiwyieqasdad[uiqwyeuiqwe];
                    quiwyieqasdad[uiqwyeuiqwe] = quiwyieqasdad[uiqwyeuiqwe - 1];
                    quiwyieqasdad[uiqwyeuiqwe - 1] = asdjasdhjkah;
                }
            }
        }
        if (TextUtils.isEmpty(bidingAdSourceId))
            return null;
        JWAdBase nmAdBase = bidingGMRewordPool.get(bidingAdSourceId);
        if (nmAdBase == null) {
            if (TextUtils.isEmpty(bidingAdSourceId)) {
                return null;
            }
            nmAdBase = new JWRewardAd(bidingAdSourceId);
            bidingGMRewordPool.put(bidingAdSourceId, nmAdBase);
        }
        return nmAdBase;
    }

    public JWAdBase getBPollInterFullPoll(String bidingAdSourceId) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] akhsdkjahsdkjah = new int[] { 1, 2, 3 };
        for (int askjdhajkhd = 1; askjdhajkhd < akhsdkjahsdkjah.length; askjdhajkhd++) {
            int asbdhjagdjhka = akhsdkjahsdkjah[askjdhajkhd];
            int asjkdhjaksd;
            for (asjkdhjaksd = askjdhajkhd - 1; asjkdhjaksd >= 0 && asbdhjagdjhka < akhsdkjahsdkjah[asjkdhjaksd]; asjkdhjaksd--) {
                akhsdkjahsdkjah[asjkdhjaksd + 1] = akhsdkjahsdkjah[asjkdhjaksd];
            }
            akhsdkjahsdkjah[asjkdhjaksd + 1] = asbdhjagdjhka;
        }
        if (TextUtils.isEmpty(bidingAdSourceId))
            return null;
        JWAdBase nmAdBase = adPoolInterFullVideo.get(bidingAdSourceId);
        if (nmAdBase == null) {
            if (TextUtils.isEmpty(bidingAdSourceId)) {
                return null;
            }
            nmAdBase = new JWInterstitialFullAd(bidingAdSourceId);
            adPoolInterFullVideo.put(bidingAdSourceId, nmAdBase);
        }
        return nmAdBase;
    }
}
